package hu.bme.mit.inf.omgi.generator;

import com.google.common.base.Objects;
import com.google.common.collect.Iterables;
import java.util.Arrays;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.IteratorExtensions;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import sysmodel.Association;
import sysmodel.AssociationEnd;
import sysmodel.Attribute;
import sysmodel.AttributeConstraints;
import sysmodel.BusinessServiceParameter;
import sysmodel.Component;
import sysmodel.DataType;
import sysmodel.Entity;
import sysmodel.Enumeration;
import sysmodel.FeatureType;
import sysmodel.GeneratorModel;
import sysmodel.HttpMethod;
import sysmodel.Literal;
import sysmodel.Multiplicity;
import sysmodel.NamedElement;
import sysmodel.OSGiBusinessComponent;
import sysmodel.OSGiBusinessService;
import sysmodel.OSGiRestComponent;
import sysmodel.OSGiRestService;
import sysmodel.RestServiceParameter;
import sysmodel.ReturnType;
import sysmodel.SystemModel;

@SuppressWarnings("all")
public class OSGiModelGenerator implements IGenerator {
  private String projectPrefix;
  
  private String folderRoot;
  
  private String project;
  
  private String folder;
  
  public void doGenerate(final Resource input, final IFileSystemAccess fsa) {
    EList<EObject> _contents = input.getContents();
    for (final EObject object : _contents) {
      this.compile(object, fsa);
    }
  }
  
  protected void _compile(final EObject m, final IFileSystemAccess fsa) {
  }
  
  protected void _compile(final SystemModel systemModel, final IFileSystemAccess fsa) {
    GeneratorModel _generatorModel = systemModel.getGeneratorModel();
    String _rootPackage = _generatorModel.getRootPackage();
    this.projectPrefix = _rootPackage;
    String _replace = this.projectPrefix.replace(".", "/");
    String _plus = ("/" + _replace);
    String _plus_1 = (_plus + "/");
    this.folderRoot = _plus_1;
    String _plus_2 = (this.projectPrefix + ".launch");
    CharSequence _generateRunConfig = this.generateRunConfig(systemModel);
    fsa.generateFile(_plus_2, _generateRunConfig);
    String _plus_3 = (this.projectPrefix + ".entities");
    this.project = _plus_3;
    this.folder = "/";
    String _plus_4 = (this.project + this.folder);
    String _plus_5 = (_plus_4 + "build.properties");
    CharSequence _generateEntitiesBuildProperties = this.generateEntitiesBuildProperties();
    fsa.generateFile(_plus_5, _generateEntitiesBuildProperties);
    String _plus_6 = (this.project + this.folder);
    String _plus_7 = (_plus_6 + ".classpath");
    CharSequence _generateEntitiesClasspath = this.generateEntitiesClasspath();
    fsa.generateFile(_plus_7, _generateEntitiesClasspath);
    String _plus_8 = (this.project + this.folder);
    String _plus_9 = (_plus_8 + ".project");
    CharSequence _generateEntitiesProject = this.generateEntitiesProject();
    fsa.generateFile(_plus_9, _generateEntitiesProject);
    this.folder = "/META-INF/";
    String _plus_10 = (this.project + this.folder);
    String _plus_11 = (_plus_10 + "MANIFEST.MF");
    CharSequence _generateEntitiesMetaInf = this.generateEntitiesMetaInf();
    fsa.generateFile(_plus_11, _generateEntitiesMetaInf);
    this.folder = "/src/META-INF/";
    String _plus_12 = (this.project + this.folder);
    String _plus_13 = (_plus_12 + "persistence.xml");
    CharSequence _generateEntitiesPersistenceXML = this.generateEntitiesPersistenceXML(systemModel);
    fsa.generateFile(_plus_13, _generateEntitiesPersistenceXML);
    String _plus_14 = ("/src" + this.folderRoot);
    String _plus_15 = (_plus_14 + "entities/");
    this.folder = _plus_15;
    String _plus_16 = (this.project + this.folder);
    String _plus_17 = (_plus_16 + "EntityManagerProvider.java");
    CharSequence _generateEntityManagerProvider = this.generateEntityManagerProvider();
    fsa.generateFile(_plus_17, _generateEntityManagerProvider);
    String _plus_18 = (this.projectPrefix + ".misc");
    this.project = _plus_18;
    this.folder = "/";
    String _plus_19 = (this.project + this.folder);
    String _plus_20 = (_plus_19 + "build.properties");
    CharSequence _generateMiscBuildProperties = this.generateMiscBuildProperties();
    fsa.generateFile(_plus_20, _generateMiscBuildProperties);
    String _plus_21 = (this.project + this.folder);
    String _plus_22 = (_plus_21 + ".classpath");
    CharSequence _generateMiscClasspath = this.generateMiscClasspath();
    fsa.generateFile(_plus_22, _generateMiscClasspath);
    String _plus_23 = (this.project + this.folder);
    String _plus_24 = (_plus_23 + ".project");
    CharSequence _generateMiscProject = this.generateMiscProject();
    fsa.generateFile(_plus_24, _generateMiscProject);
    this.folder = "/META-INF/";
    String _plus_25 = (this.project + this.folder);
    String _plus_26 = (_plus_25 + "MANIFEST.MF");
    CharSequence _generateMiscMetaInf = this.generateMiscMetaInf();
    fsa.generateFile(_plus_26, _generateMiscMetaInf);
    TreeIterator<EObject> _eAllContents = systemModel.eAllContents();
    Iterable<EObject> _iterable = IteratorExtensions.<EObject>toIterable(_eAllContents);
    for (final EObject object : _iterable) {
      this.compile(object, fsa);
    }
  }
  
  protected void _compile(final Entity entity, final IFileSystemAccess fsa) {
    String _plus = (this.projectPrefix + ".entities");
    this.project = _plus;
    String _plus_1 = ("/src" + this.folderRoot);
    String _plus_2 = (_plus_1 + "entities/");
    this.folder = _plus_2;
    String _plus_3 = (this.project + this.folder);
    String _name = entity.getName();
    String _plus_4 = (_plus_3 + _name);
    String _plus_5 = (_plus_4 + ".java");
    CharSequence _generate = this.generate(entity);
    fsa.generateFile(_plus_5, _generate);
  }
  
  protected void _compile(final Enumeration enumeration, final IFileSystemAccess fsa) {
    String _plus = (this.projectPrefix + ".misc");
    this.project = _plus;
    String _plus_1 = ("/src" + this.folderRoot);
    String _plus_2 = (_plus_1 + "misc/enumerations/");
    this.folder = _plus_2;
    String _plus_3 = (this.project + this.folder);
    String _name = enumeration.getName();
    String _plus_4 = (_plus_3 + _name);
    String _plus_5 = (_plus_4 + ".java");
    CharSequence _generate = this.generate(enumeration);
    fsa.generateFile(_plus_5, _generate);
  }
  
  protected void _compile(final sysmodel.Exception exception, final IFileSystemAccess fsa) {
    String _plus = (this.projectPrefix + ".misc");
    this.project = _plus;
    String _plus_1 = ("/src" + this.folderRoot);
    String _plus_2 = (_plus_1 + "misc/exceptions/");
    this.folder = _plus_2;
    String _plus_3 = (this.project + this.folder);
    String _name = exception.getName();
    String _plus_4 = (_plus_3 + _name);
    String _plus_5 = (_plus_4 + ".java");
    CharSequence _generate = this.generate(exception);
    fsa.generateFile(_plus_5, _generate);
  }
  
  protected void _compile(final OSGiRestComponent component, final IFileSystemAccess fsa) {
    String _plus = (this.projectPrefix + ".");
    String _name = component.getName();
    String _lowerCase = _name.toLowerCase();
    String _plus_1 = (_plus + _lowerCase);
    this.project = _plus_1;
    String _plus_2 = ("/src" + this.folderRoot);
    String _name_1 = component.getName();
    String _lowerCase_1 = _name_1.toLowerCase();
    String _plus_3 = (_plus_2 + _lowerCase_1);
    String _plus_4 = (_plus_3 + "/interfaces/");
    this.folder = _plus_4;
    String _plus_5 = (this.project + this.folder);
    String _plus_6 = (_plus_5 + "I");
    String _name_2 = component.getName();
    String _plus_7 = (_plus_6 + _name_2);
    String _plus_8 = (_plus_7 + ".java");
    CharSequence _generateInterface = this.generateInterface(component);
    fsa.generateFile(_plus_8, _generateInterface);
    String _plus_9 = ("/src" + this.folderRoot);
    String _name_3 = component.getName();
    String _lowerCase_2 = _name_3.toLowerCase();
    String _plus_10 = (_plus_9 + _lowerCase_2);
    String _plus_11 = (_plus_10 + "/");
    String _plus_12 = (_plus_11 + "implementation/");
    this.folder = _plus_12;
    String _plus_13 = (this.project + this.folder);
    String _name_4 = component.getName();
    String _plus_14 = (_plus_13 + _name_4);
    String _plus_15 = (_plus_14 + ".java");
    CharSequence _generateImplementation = this.generateImplementation(component);
    fsa.generateFile(_plus_15, _generateImplementation);
    this.folder = "/";
    String _plus_16 = (this.project + this.folder);
    String _plus_17 = (_plus_16 + "build.properties");
    CharSequence _generateBuildProperties = this.generateBuildProperties(component);
    fsa.generateFile(_plus_17, _generateBuildProperties);
    String _plus_18 = (this.project + this.folder);
    String _plus_19 = (_plus_18 + ".classpath");
    CharSequence _generateClasspath = this.generateClasspath(component);
    fsa.generateFile(_plus_19, _generateClasspath);
    String _plus_20 = (this.project + this.folder);
    String _plus_21 = (_plus_20 + ".project");
    CharSequence _generateProject = this.generateProject(component);
    fsa.generateFile(_plus_21, _generateProject);
    this.folder = "/META-INF/";
    String _plus_22 = (this.project + this.folder);
    String _plus_23 = (_plus_22 + "MANIFEST.MF");
    CharSequence _generateMetaInf = this.generateMetaInf(component);
    fsa.generateFile(_plus_23, _generateMetaInf);
    this.folder = "/src/OSGI-INF/";
    String _plus_24 = (this.project + "/OSGI-INF/component.xml");
    CharSequence _generateComponentXML = this.generateComponentXML(component);
    fsa.generateFile(_plus_24, _generateComponentXML);
  }
  
  protected void _compile(final OSGiBusinessComponent component, final IFileSystemAccess fsa) {
    String _plus = (this.projectPrefix + ".business");
    this.project = _plus;
    String _plus_1 = ("/src" + this.folderRoot);
    String _plus_2 = (_plus_1 + "business/interfaces/");
    this.folder = _plus_2;
    String _plus_3 = (this.project + this.folder);
    String _plus_4 = (_plus_3 + "I");
    String _name = component.getName();
    String _plus_5 = (_plus_4 + _name);
    String _plus_6 = (_plus_5 + ".java");
    CharSequence _generateInterface = this.generateInterface(component);
    fsa.generateFile(_plus_6, _generateInterface);
    String _plus_7 = ("/src" + this.folderRoot);
    String _plus_8 = (_plus_7 + "business/implementation/");
    this.folder = _plus_8;
    String _plus_9 = (this.project + this.folder);
    String _name_1 = component.getName();
    String _plus_10 = (_plus_9 + _name_1);
    String _plus_11 = (_plus_10 + ".java");
    CharSequence _generateImplementation = this.generateImplementation(component);
    fsa.generateFile(_plus_11, _generateImplementation);
    this.folder = "/";
    String _plus_12 = (this.project + this.folder);
    String _plus_13 = (_plus_12 + "build.properties");
    CharSequence _generateBusinessBuildProperties = this.generateBusinessBuildProperties();
    fsa.generateFile(_plus_13, _generateBusinessBuildProperties);
    String _plus_14 = (this.project + this.folder);
    String _plus_15 = (_plus_14 + ".classpath");
    CharSequence _generateBusinessClasspath = this.generateBusinessClasspath();
    fsa.generateFile(_plus_15, _generateBusinessClasspath);
    String _plus_16 = (this.project + this.folder);
    String _plus_17 = (_plus_16 + ".project");
    CharSequence _generateBusinessProject = this.generateBusinessProject();
    fsa.generateFile(_plus_17, _generateBusinessProject);
    this.folder = "/META-INF/";
    String _plus_18 = (this.project + this.folder);
    String _plus_19 = (_plus_18 + "MANIFEST.MF");
    CharSequence _generateBusinessMetaInf = this.generateBusinessMetaInf();
    fsa.generateFile(_plus_19, _generateBusinessMetaInf);
  }
  
  public CharSequence generateRunConfig(final SystemModel systemModel) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
    _builder.newLine();
    _builder.append("<launchConfiguration type=\"org.eclipse.pde.ui.EquinoxLauncher\">");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"append.args\" value=\"true\"/>");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"automaticAdd\" value=\"false\"/>");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"automaticValidate\" value=\"false\"/>");
    _builder.newLine();
    _builder.append("<stringAttribute key=\"bootstrap\" value=\"\"/>");
    _builder.newLine();
    _builder.append("<stringAttribute key=\"checked\" value=\"[NONE]\"/>");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"clearConfig\" value=\"false\"/>");
    _builder.newLine();
    _builder.append("<stringAttribute key=\"configLocation\" value=\"${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/New_configuration\"/>");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"default\" value=\"true\"/>");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"default_auto_start\" value=\"true\"/>");
    _builder.newLine();
    _builder.append("<intAttribute key=\"default_start_level\" value=\"4\"/>");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"includeOptional\" value=\"false\"/>");
    _builder.newLine();
    _builder.append("<stringAttribute key=\"org.eclipse.jdt.launching.PROGRAM_ARGUMENTS\" value=\"-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console\"/>");
    _builder.newLine();
    _builder.append("<stringAttribute key=\"org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER\" value=\"org.eclipse.pde.ui.workbenchClasspathProvider\"/>");
    _builder.newLine();
    _builder.append("<stringAttribute key=\"org.eclipse.jdt.launching.VM_ARGUMENTS\" value=\"-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.osgi.service.http.port=8081\"/>");
    _builder.newLine();
    _builder.append("<stringAttribute key=\"pde.version\" value=\"3.3\"/>");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"show_selected_only\" value=\"false\"/>");
    _builder.newLine();
    _builder.append("<stringAttribute key=\"target_bundles\" value=\"com.eclipsesource.jaxrs.connector@default:default,com.sun.jersey.jersey-core@default:default,com.sun.jersey.jersey-server@default:default,com.sun.jersey.jersey-servlet@default:default,javax.activation*1.1.0.v201005080500@default:default,javax.activation*1.1.0.v201108011116@default:default,javax.jms@default:default,javax.mail@default:default,javax.persistence*2.0.3.v201010191057@default:default,javax.resource@default:default,javax.servlet*2.5.0.v201103041518@default:default,javax.servlet.jsp@default:default,javax.transaction@default:default,javax.xml.stream@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.commons.el@default:default,org.apache.commons.logging@default:default,org.apache.derby@default:default,org.apache.jasper@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.persistence.antlr@default:default,org.eclipse.persistence.asm@default:default,org.eclipse.persistence.core@default:default,org.eclipse.persistence.jpa.equinox.weaving@default:false,org.eclipse.persistence.jpa.equinox@default:false,org.eclipse.persistence.jpa.osgi@default:default,org.eclipse.persistence.jpa@default:default,org.eclipse.persistence.oracle@default:false,org.mortbay.jetty.server@default:default,org.mortbay.jetty.util@default:default,org.objectweb.asm@default:default\"/>");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"tracing\" value=\"false\"/>");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"useCustomFeatures\" value=\"false\"/>");
    _builder.newLine();
    _builder.append("<booleanAttribute key=\"useDefaultConfigArea\" value=\"true\"/>");
    _builder.newLine();
    _builder.append("<stringAttribute key=\"workspace_bundles\" value=\"");
    _builder.append(this.projectPrefix, "");
    _builder.append(".business@default:default,");
    _builder.append(this.projectPrefix, "");
    _builder.append(".entities@default:default,");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc@default:default,");
    {
      EList<Component> _components = systemModel.getComponents();
      Iterable<OSGiRestComponent> _filter = Iterables.<OSGiRestComponent>filter(_components, OSGiRestComponent.class);
      for(final OSGiRestComponent component : _filter) {
        _builder.append(this.projectPrefix, "");
        _builder.append(".");
        String _name = component.getName();
        String _lowerCase = _name.toLowerCase();
        _builder.append(_lowerCase, "");
        _builder.append("@default:default");
        {
          EList<Component> _components_1 = systemModel.getComponents();
          Iterable<OSGiRestComponent> _filter_1 = Iterables.<OSGiRestComponent>filter(_components_1, OSGiRestComponent.class);
          OSGiRestComponent _last = IterableExtensions.<OSGiRestComponent>last(_filter_1);
          boolean _notEquals = (!Objects.equal(component, _last));
          if (_notEquals) {
            _builder.append(",");
          }
        }
      }
    }
    _builder.append("\"/>");
    _builder.newLineIfNotEmpty();
    _builder.append("</launchConfiguration>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateBusinessMetaInf() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("Manifest-Version: 1.0");
    _builder.newLine();
    _builder.append("Bundle-ManifestVersion: 2");
    _builder.newLine();
    _builder.append("Bundle-Name: Entities");
    _builder.newLine();
    _builder.append("Bundle-SymbolicName: ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".business");
    _builder.newLineIfNotEmpty();
    _builder.append("Bundle-Version: 1.0.0.qualifier");
    _builder.newLine();
    _builder.append("Require-Bundle: javax.persistence;bundle-version=\"2.0.3\",");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("mdsd.team2.osgi.misc;bundle-version=\"1.0.0\",");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("mdsd.team2.osgi.entities;bundle-version=\"1.0.0\"");
    _builder.newLine();
    _builder.append("Export-Package: mdsd.team2.osgi.business.implementation,");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("mdsd.team2.osgi.business.interfaces");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateBusinessBuildProperties() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("source.. = src/");
    _builder.newLine();
    _builder.append("output.. = bin/");
    _builder.newLine();
    _builder.append("bin.includes = META-INF/,\\");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append(".");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateBusinessClasspath() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    _builder.newLine();
    _builder.append("<classpath>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"con\" path=\"org.eclipse.pde.core.requiredPlugins\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"src\" path=\"src\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"output\" path=\"bin\"/>");
    _builder.newLine();
    _builder.append("</classpath>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateBusinessProject() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    _builder.newLine();
    _builder.append("<projectDescription>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<name>");
    _builder.append(this.projectPrefix, "	");
    _builder.append(".business</name>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("<comment></comment>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<projects>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</projects>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<buildSpec>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.jdt.core.javabuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.pde.ManifestBuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.pde.SchemaBuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</buildSpec>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<natures>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<nature>org.eclipse.pde.PluginNature</nature>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<nature>org.eclipse.jdt.core.javanature</nature>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</natures>");
    _builder.newLine();
    _builder.append("</projectDescription>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateEntitiesMetaInf() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("Manifest-Version: 1.0");
    _builder.newLine();
    _builder.append("Bundle-ManifestVersion: 2");
    _builder.newLine();
    _builder.append("Bundle-Name: Entities");
    _builder.newLine();
    _builder.append("Bundle-SymbolicName: ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".entities");
    _builder.newLineIfNotEmpty();
    _builder.append("Bundle-Version: 1.0.0.qualifier");
    _builder.newLine();
    _builder.append("Require-Bundle: org.eclipse.persistence.jpa;bundle-version=\"2.3.1\",");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("javax.persistence;bundle-version=\"2.0.3\",");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("org.apache.derby;bundle-version=\"10.5.1\",");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("mdsd.team2.osgi.misc;bundle-version=\"1.0.0\"");
    _builder.newLine();
    _builder.append("Export-Package: ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".entities");
    _builder.newLineIfNotEmpty();
    _builder.append("JPA-PersistenceUnits: ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".jpa");
    _builder.newLineIfNotEmpty();
    return _builder;
  }
  
  public CharSequence generateEntitiesBuildProperties() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("source.. = src/");
    _builder.newLine();
    _builder.append("output.. = bin/");
    _builder.newLine();
    _builder.append("bin.includes = META-INF/,\\");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append(".");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateEntitiesClasspath() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    _builder.newLine();
    _builder.append("<classpath>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"con\" path=\"org.eclipse.pde.core.requiredPlugins\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"src\" path=\"src\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"output\" path=\"bin\"/>");
    _builder.newLine();
    _builder.append("</classpath>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateEntitiesProject() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    _builder.newLine();
    _builder.append("<projectDescription>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<name>");
    _builder.append(this.projectPrefix, "	");
    _builder.append(".entities</name>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("<comment></comment>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<projects>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</projects>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<buildSpec>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.jdt.core.javabuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.pde.ManifestBuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.pde.SchemaBuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</buildSpec>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<natures>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<nature>org.eclipse.pde.PluginNature</nature>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<nature>org.eclipse.jdt.core.javanature</nature>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</natures>");
    _builder.newLine();
    _builder.append("</projectDescription>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateEntitiesPersistenceXML(final SystemModel systemModel) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
    _builder.newLine();
    _builder.append("<persistence version=\"2.0\" xmlns=\"http://java.sun.com/xml/ns/persistence\" ");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("<persistence-unit name=\"");
    _builder.append(this.projectPrefix, "    ");
    _builder.append(".jpa\" transaction-type=\"RESOURCE_LOCAL\">");
    _builder.newLineIfNotEmpty();
    {
      EList<DataType> _types = systemModel.getTypes();
      Iterable<Entity> _filter = Iterables.<Entity>filter(_types, Entity.class);
      for(final Entity entity : _filter) {
        _builder.append("    ");
        _builder.append("<class>");
        _builder.append(this.projectPrefix, "    ");
        _builder.append(".entities.");
        String _name = entity.getName();
        _builder.append(_name, "    ");
        _builder.append("</class>");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("        ");
    _builder.append("<properties>");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<!-- Embedded Derby Login -->");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"javax.persistence.jdbc.driver\" value=\"org.apache.derby.jdbc.EmbeddedDriver\"/>");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"javax.persistence.jdbc.url\" value=\"jdbc:derby:db;create=true\"/>");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<!-- don\'t need userid/password in embedded Derby -->");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.target-database\" value=\"Derby\"/>");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.jdbc.read-connections.min\" value=\"1\"/>");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.jdbc.write-connections.min\" value=\"1\"/>");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.jdbc.batch-writing\" value=\"JDBC\"/>");
    _builder.newLine();
    _builder.append(" ");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<!-- Database Schema Creation -->");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.ddl-generation\" value=\"drop-and-create-tables\"/>");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.ddl-generation.output-mode\" value=\"database\"/>");
    _builder.newLine();
    _builder.append(" ");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<!-- Logging Settings -->");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.logging.level\" value=\"FINE\" />");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.logging.thread\" value=\"false\" />");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.logging.session\" value=\"false\" />");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.logging.exceptions\" value=\"true\" />");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("<property name=\"eclipselink.logging.timestamp\" value=\"false\"/>            ");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("</properties>");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("</persistence-unit>");
    _builder.newLine();
    _builder.append("</persistence>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateEntityManagerProvider() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".entities;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("import javax.persistence.EntityManager;");
    _builder.newLine();
    _builder.append("import javax.persistence.EntityManagerFactory;");
    _builder.newLine();
    _builder.append("import javax.persistence.Persistence;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import java.lang.RuntimeException;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("public class EntityManagerProvider {");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("private final static EntityManagerFactory entityManagerFactory = Persistence");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append(".createEntityManagerFactory(\"");
    _builder.append(this.projectPrefix, "			");
    _builder.append(".jpa\");");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public static EntityManager getEntityManager() throws RuntimeException {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (entityManagerFactory == null) {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("throw new RuntimeException(\"Persistence factory error!\");");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("EntityManager em = entityManagerFactory.createEntityManager();");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (em == null) {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("throw new RuntimeException(\"Database cannot be resolved!\");");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("return em;");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateMiscMetaInf() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("Manifest-Version: 1.0");
    _builder.newLine();
    _builder.append("Bundle-ManifestVersion: 2");
    _builder.newLine();
    _builder.append("Bundle-Name: Misc");
    _builder.newLine();
    _builder.append("Bundle-SymbolicName: ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc");
    _builder.newLineIfNotEmpty();
    _builder.append("Bundle-Version: 1.0.0.qualifier");
    _builder.newLine();
    _builder.append("Bundle-RequiredExecutionEnvironment: JavaSE-1.7");
    _builder.newLine();
    _builder.append("Export-Package: ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc.enumerations,");
    _builder.newLineIfNotEmpty();
    _builder.append(" ");
    _builder.append(this.projectPrefix, " ");
    _builder.append(".misc.exceptions");
    _builder.newLineIfNotEmpty();
    return _builder;
  }
  
  public CharSequence generateMiscBuildProperties() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("source.. = src/");
    _builder.newLine();
    _builder.append("output.. = bin/");
    _builder.newLine();
    _builder.append("bin.includes = META-INF/,\\");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append(".");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateMiscClasspath() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    _builder.newLine();
    _builder.append("<classpath>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"con\" path=\"org.eclipse.pde.core.requiredPlugins\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"src\" path=\"src\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"output\" path=\"bin\"/>");
    _builder.newLine();
    _builder.append("</classpath>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateMiscProject() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    _builder.newLine();
    _builder.append("<projectDescription>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<name>");
    _builder.append(this.projectPrefix, "	");
    _builder.append(".misc</name>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("<comment></comment>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<projects>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</projects>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<buildSpec>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.jdt.core.javabuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.pde.ManifestBuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.pde.SchemaBuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</buildSpec>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<natures>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<nature>org.eclipse.pde.PluginNature</nature>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<nature>org.eclipse.jdt.core.javanature</nature>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</natures>");
    _builder.newLine();
    _builder.append("</projectDescription>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateMetaInf(final OSGiRestComponent component) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("Manifest-Version: 1.0");
    _builder.newLine();
    _builder.append("Bundle-ManifestVersion: 2");
    _builder.newLine();
    _builder.append("Bundle-Name: ");
    String _name = component.getName();
    _builder.append(_name, "");
    _builder.newLineIfNotEmpty();
    _builder.append("Bundle-SymbolicName: ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".");
    String _name_1 = component.getName();
    String _lowerCase = _name_1.toLowerCase();
    _builder.append(_lowerCase, "");
    _builder.newLineIfNotEmpty();
    _builder.append("Bundle-Version: 1.0.0.qualifier");
    _builder.newLine();
    _builder.append("Bundle-RequiredExecutionEnvironment: JavaSE-1.6");
    _builder.newLine();
    _builder.append("Import-Package: org.osgi.framework;version=\"1.6.0\"");
    _builder.newLine();
    _builder.append("Service-Component: OSGI-INF/component.xml");
    _builder.newLine();
    _builder.append("Export-Package: ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".");
    String _name_2 = component.getName();
    String _lowerCase_1 = _name_2.toLowerCase();
    _builder.append(_lowerCase_1, "");
    _builder.append(".interfaces,");
    _builder.newLineIfNotEmpty();
    _builder.append(" ");
    _builder.append(this.projectPrefix, " ");
    _builder.append(".");
    String _name_3 = component.getName();
    String _lowerCase_2 = _name_3.toLowerCase();
    _builder.append(_lowerCase_2, " ");
    _builder.append(".implementation");
    _builder.newLineIfNotEmpty();
    _builder.append("Require-Bundle: com.sun.jersey.jersey-core;bundle-version=\"1.11.0\",");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("com.sun.jersey.jersey-server;bundle-version=\"1.11.0\",");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("com.sun.jersey.jersey-servlet;bundle-version=\"1.11.0\",");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("com.eclipsesource.jaxrs.connector;bundle-version=\"1.0.0\",");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("javax.persistence;bundle-version=\"2.0.3\",");
    _builder.newLine();
    _builder.append(" ");
    _builder.append(this.projectPrefix, " ");
    _builder.append(".business;bundle-version=\"1.0.0\",");
    _builder.newLineIfNotEmpty();
    _builder.append(" ");
    _builder.append(this.projectPrefix, " ");
    _builder.append(".entities;bundle-version=\"1.0.0\",");
    _builder.newLineIfNotEmpty();
    _builder.append(" ");
    _builder.append(this.projectPrefix, " ");
    _builder.append(".misc;bundle-version=\"1.0.0\"");
    _builder.newLineIfNotEmpty();
    return _builder;
  }
  
  public CharSequence generateBuildProperties(final OSGiRestComponent component) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("output.. = bin/");
    _builder.newLine();
    _builder.append("bin.includes = META-INF/,\\");
    _builder.newLine();
    _builder.append("               ");
    _builder.append("OSGI-INF/component.xml");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateClasspath(final OSGiRestComponent component) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    _builder.newLine();
    _builder.append("<classpath>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"con\" path=\"org.eclipse.pde.core.requiredPlugins\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"con\" path=\"org.eclipse.jdt.junit.JUNIT_CONTAINER/4\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"src\" path=\"src\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<classpathentry kind=\"output\" path=\"bin\"/>");
    _builder.newLine();
    _builder.append("</classpath>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateProject(final OSGiRestComponent component) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    _builder.newLine();
    _builder.append("<projectDescription>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<name>");
    _builder.append(this.projectPrefix, "	");
    _builder.append(".");
    String _name = component.getName();
    String _lowerCase = _name.toLowerCase();
    _builder.append(_lowerCase, "	");
    _builder.append("</name>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("<comment></comment>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<projects>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</projects>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<buildSpec>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.jdt.core.javabuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.pde.ManifestBuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.pde.SchemaBuilder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<buildCommand>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<name>org.eclipse.pde.ds.core.builder</name>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<arguments>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</arguments>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</buildCommand>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</buildSpec>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<natures>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<nature>org.eclipse.pde.PluginNature</nature>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<nature>org.eclipse.jdt.core.javanature</nature>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</natures>");
    _builder.newLine();
    _builder.append("</projectDescription>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateComponentXML(final OSGiRestComponent component) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    _builder.newLine();
    _builder.append("<scr:component xmlns:scr=\"http://www.osgi.org/xmlns/scr/v1.1.0\" name=\"mdsd.team2.osgi.");
    String _name = component.getName();
    String _lowerCase = _name.toLowerCase();
    _builder.append(_lowerCase, "");
    _builder.append("\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("<implementation class=\"");
    _builder.append(this.projectPrefix, "	");
    _builder.append(".");
    String _name_1 = component.getName();
    String _lowerCase_1 = _name_1.toLowerCase();
    _builder.append(_lowerCase_1, "	");
    _builder.append(".implementation.");
    String _name_2 = component.getName();
    _builder.append(_name_2, "	");
    _builder.append("\"/>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("<service>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<provide interface=\"");
    _builder.append(this.projectPrefix, "		");
    _builder.append(".");
    String _name_3 = component.getName();
    String _lowerCase_2 = _name_3.toLowerCase();
    _builder.append(_lowerCase_2, "		");
    _builder.append(".interfaces.I");
    String _name_4 = component.getName();
    _builder.append(_name_4, "		");
    _builder.append("\"/>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("</service>");
    _builder.newLine();
    _builder.append("</scr:component>");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generate(final Enumeration enumeration) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc.enumerations;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("public enum ");
    String _name = enumeration.getName();
    _builder.append(_name, "");
    _builder.append(" {");
    _builder.newLineIfNotEmpty();
    {
      EList<Literal> _literals = enumeration.getLiterals();
      for(final Literal literal : _literals) {
        String _text = literal.getText();
        _builder.append(_text, "");
        {
          EList<Literal> _literals_1 = enumeration.getLiterals();
          Literal _last = IterableExtensions.<Literal>last(_literals_1);
          boolean _notEquals = (!Objects.equal(literal, _last));
          if (_notEquals) {
            _builder.append(",");
          } else {
            _builder.append(";");
          }
        }
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generate(final sysmodel.Exception exception) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc.exceptions;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("public class ");
    String _name = exception.getName();
    _builder.append(_name, "");
    _builder.append(" extends Exception {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public ");
    String _name_1 = exception.getName();
    _builder.append(_name_1, "	");
    _builder.append("() {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("super(\"");
    String _message = exception.getMessage();
    _builder.append(_message, "		");
    _builder.append("\");");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public ");
    String _name_2 = exception.getName();
    _builder.append(_name_2, "	");
    _builder.append("(String message) {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("super(message);");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generate(final Entity entity) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".entities;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("import java.lang.String;");
    _builder.newLine();
    _builder.append("import java.lang.Integer;");
    _builder.newLine();
    _builder.append("import java.util.Date;");
    _builder.newLine();
    _builder.append("import java.util.List;");
    _builder.newLine();
    _builder.append("import java.util.ArrayList;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import javax.persistence.Column;");
    _builder.newLine();
    _builder.append("import javax.persistence.Entity;");
    _builder.newLine();
    _builder.append("import javax.persistence.Id;");
    _builder.newLine();
    _builder.append("import javax.persistence.GeneratedValue;");
    _builder.newLine();
    _builder.append("import javax.persistence.JoinColumn;");
    _builder.newLine();
    _builder.append("import javax.persistence.JoinTable;");
    _builder.newLine();
    _builder.append("import javax.persistence.OneToOne;");
    _builder.newLine();
    _builder.append("import javax.persistence.ManyToOne;");
    _builder.newLine();
    _builder.append("import javax.persistence.OneToMany;");
    _builder.newLine();
    _builder.append("import javax.persistence.ManyToMany;");
    _builder.newLine();
    _builder.append("import javax.persistence.Temporal;");
    _builder.newLine();
    _builder.append("import javax.persistence.TemporalType;");
    _builder.newLine();
    _builder.append("import javax.persistence.MappedSuperclass;");
    _builder.newLine();
    _builder.append("import javax.persistence.NamedQuery;");
    _builder.newLine();
    _builder.append("import javax.persistence.NamedQueries;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc.enumerations.*;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    {
      boolean _isIsAbstract = entity.isIsAbstract();
      if (_isIsAbstract) {
        _builder.append("@MappedSuperclass");
        _builder.newLine();
      } else {
        _builder.append("@Entity");
        _builder.newLine();
        _builder.append("@NamedQueries({");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("@NamedQuery(name=");
        String _name = entity.getName();
        _builder.append(_name, "	");
        _builder.append(".GET_");
        String _name_1 = entity.getName();
        String _upperCase = _name_1.toUpperCase();
        _builder.append(_upperCase, "	");
        _builder.append("S, query=\"SELECT x FROM ");
        String _name_2 = entity.getName();
        _builder.append(_name_2, "	");
        _builder.append(" x\"),");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("@NamedQuery(name=");
        String _name_3 = entity.getName();
        _builder.append(_name_3, "	");
        _builder.append(".GET_");
        String _name_4 = entity.getName();
        String _upperCase_1 = _name_4.toUpperCase();
        _builder.append(_upperCase_1, "	");
        _builder.append("_BY_ID, query=\"SELECT x FROM ");
        String _name_5 = entity.getName();
        _builder.append(_name_5, "	");
        _builder.append(" x WHERE x.ID = :id\")})");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.newLine();
    _builder.append("public ");
    {
      boolean _isIsAbstract_1 = entity.isIsAbstract();
      if (_isIsAbstract_1) {
        _builder.append("abstract ");
      }
    }
    _builder.append("class ");
    String _name_6 = entity.getName();
    _builder.append(_name_6, "");
    _builder.append(" ");
    {
      Entity _superType = entity.getSuperType();
      boolean _notEquals = (!Objects.equal(_superType, null));
      if (_notEquals) {
        _builder.append("extends ");
        Entity _superType_1 = entity.getSuperType();
        String _name_7 = _superType_1.getName();
        _builder.append(_name_7, "");
        _builder.append(" ");
      }
    }
    _builder.append("{\t");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    {
      boolean _isIsAbstract_2 = entity.isIsAbstract();
      boolean _not = (!_isIsAbstract_2);
      if (_not) {
        _builder.append("public static final String GET_");
        String _name_8 = entity.getName();
        String _upperCase_2 = _name_8.toUpperCase();
        _builder.append(_upperCase_2, "");
        _builder.append("S = \"Get");
        String _name_9 = entity.getName();
        _builder.append(_name_9, "");
        _builder.append("s\";");
        _builder.newLineIfNotEmpty();
        _builder.append("public static final String GET_");
        String _name_10 = entity.getName();
        String _upperCase_3 = _name_10.toUpperCase();
        _builder.append(_upperCase_3, "");
        _builder.append("_BY_ID = \"Get");
        String _name_11 = entity.getName();
        _builder.append(_name_11, "");
        _builder.append("ById\";");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.newLine();
    {
      EList<Attribute> _attributes = entity.getAttributes();
      for(final Attribute attribute : _attributes) {
        _builder.newLine();
        {
          EList<AttributeConstraints> _constraints = attribute.getConstraints();
          boolean _contains = _constraints.contains(AttributeConstraints.PRIMARY_KEY);
          if (_contains) {
            _builder.append("@Id");
            _builder.newLine();
            _builder.append("@GeneratedValue");
            _builder.newLine();
          }
        }
        {
          FeatureType _type = attribute.getType();
          DataType _dataType = _type.getDataType();
          String _name_12 = _dataType.getName();
          boolean _equals = Objects.equal(_name_12, "Date");
          if (_equals) {
            _builder.append("@Temporal(TemporalType.DATE)");
            _builder.newLine();
          }
        }
        _builder.append("private ");
        FeatureType _type_1 = attribute.getType();
        DataType _dataType_1 = _type_1.getDataType();
        String _name_13 = _dataType_1.getName();
        _builder.append(_name_13, "");
        _builder.append(" ");
        String _name_14 = attribute.getName();
        _builder.append(_name_14, "");
        _builder.append(";");
        _builder.newLineIfNotEmpty();
        _builder.newLine();
        CharSequence _generateGetter = this.generateGetter(attribute);
        _builder.append(_generateGetter, "");
        _builder.newLineIfNotEmpty();
        _builder.newLine();
        CharSequence _generateSetter = this.generateSetter(attribute);
        _builder.append(_generateSetter, "");
        _builder.newLineIfNotEmpty();
        _builder.newLine();
      }
    }
    _builder.newLine();
    {
      EList<AssociationEnd> _associationEnd = entity.getAssociationEnd();
      for(final AssociationEnd associationEnd : _associationEnd) {
        {
          Association _association = associationEnd.getAssociation();
          EList<AssociationEnd> _associationEnd_1 = _association.getAssociationEnd();
          AssociationEnd _get = _associationEnd_1.get(0);
          Entity _associatedEntity = _get.getAssociatedEntity();
          boolean _notEquals_1 = (!Objects.equal(_associatedEntity, entity));
          if (_notEquals_1) {
            {
              Association _association_1 = associationEnd.getAssociation();
              EList<AssociationEnd> _associationEnd_2 = _association_1.getAssociationEnd();
              AssociationEnd _get_1 = _associationEnd_2.get(0);
              Multiplicity _multiplicity = _get_1.getMultiplicity();
              boolean _equals_1 = Objects.equal(_multiplicity, Multiplicity.ONE);
              if (_equals_1) {
                {
                  Multiplicity _multiplicity_1 = associationEnd.getMultiplicity();
                  boolean _equals_2 = Objects.equal(_multiplicity_1, Multiplicity.ONE);
                  if (_equals_2) {
                    _builder.append("@OneToOne(mappedBy=\"");
                    String _name_15 = associationEnd.getName();
                    _builder.append(_name_15, "");
                    _builder.append("\")");
                    _builder.newLineIfNotEmpty();
                  } else {
                    _builder.append("@ManyToOne");
                    _builder.newLine();
                  }
                }
                _builder.append("private ");
                Association _association_2 = associationEnd.getAssociation();
                EList<AssociationEnd> _associationEnd_3 = _association_2.getAssociationEnd();
                AssociationEnd _get_2 = _associationEnd_3.get(0);
                Entity _associatedEntity_1 = _get_2.getAssociatedEntity();
                String _name_16 = _associatedEntity_1.getName();
                _builder.append(_name_16, "");
                _builder.append(" ");
                Association _association_3 = associationEnd.getAssociation();
                EList<AssociationEnd> _associationEnd_4 = _association_3.getAssociationEnd();
                AssociationEnd _get_3 = _associationEnd_4.get(0);
                String _name_17 = _get_3.getName();
                _builder.append(_name_17, "");
                _builder.append(";");
                _builder.newLineIfNotEmpty();
              } else {
                {
                  Multiplicity _multiplicity_2 = associationEnd.getMultiplicity();
                  boolean _equals_3 = Objects.equal(_multiplicity_2, Multiplicity.ONE);
                  if (_equals_3) {
                    _builder.append("@OneToMany(mappedBy=\"");
                    String _name_18 = associationEnd.getName();
                    _builder.append(_name_18, "");
                    _builder.append("\")");
                    _builder.newLineIfNotEmpty();
                  } else {
                    _builder.append("@ManyToMany(mappedBy=\"");
                    String _name_19 = associationEnd.getName();
                    _builder.append(_name_19, "");
                    _builder.append("\")");
                    _builder.newLineIfNotEmpty();
                  }
                }
                _builder.append("private List<");
                Association _association_4 = associationEnd.getAssociation();
                EList<AssociationEnd> _associationEnd_5 = _association_4.getAssociationEnd();
                AssociationEnd _get_4 = _associationEnd_5.get(0);
                Entity _associatedEntity_2 = _get_4.getAssociatedEntity();
                String _name_20 = _associatedEntity_2.getName();
                _builder.append(_name_20, "");
                _builder.append("> ");
                Association _association_5 = associationEnd.getAssociation();
                EList<AssociationEnd> _associationEnd_6 = _association_5.getAssociationEnd();
                AssociationEnd _get_5 = _associationEnd_6.get(0);
                String _name_21 = _get_5.getName();
                _builder.append(_name_21, "");
                _builder.append(" = new ArrayList<");
                Association _association_6 = associationEnd.getAssociation();
                EList<AssociationEnd> _associationEnd_7 = _association_6.getAssociationEnd();
                AssociationEnd _get_6 = _associationEnd_7.get(0);
                Entity _associatedEntity_3 = _get_6.getAssociatedEntity();
                String _name_22 = _associatedEntity_3.getName();
                _builder.append(_name_22, "");
                _builder.append(">();");
                _builder.newLineIfNotEmpty();
              }
            }
            _builder.append("\t");
            _builder.newLine();
            _builder.append("\t");
            Association _association_7 = associationEnd.getAssociation();
            EList<AssociationEnd> _associationEnd_8 = _association_7.getAssociationEnd();
            AssociationEnd _get_7 = _associationEnd_8.get(0);
            CharSequence _generateGetter_1 = this.generateGetter(_get_7);
            _builder.append(_generateGetter_1, "	");
            _builder.newLineIfNotEmpty();
            _builder.newLine();
            _builder.append("\t");
            Association _association_8 = associationEnd.getAssociation();
            EList<AssociationEnd> _associationEnd_9 = _association_8.getAssociationEnd();
            AssociationEnd _get_8 = _associationEnd_9.get(0);
            CharSequence _generateSetter_1 = this.generateSetter(_get_8);
            _builder.append(_generateSetter_1, "	");
            _builder.append("\t\t\t");
            _builder.newLineIfNotEmpty();
          } else {
            {
              Association _association_9 = associationEnd.getAssociation();
              EList<AssociationEnd> _associationEnd_10 = _association_9.getAssociationEnd();
              AssociationEnd _get_9 = _associationEnd_10.get(1);
              Multiplicity _multiplicity_3 = _get_9.getMultiplicity();
              boolean _equals_4 = Objects.equal(_multiplicity_3, Multiplicity.ONE);
              if (_equals_4) {
                {
                  Multiplicity _multiplicity_4 = associationEnd.getMultiplicity();
                  boolean _equals_5 = Objects.equal(_multiplicity_4, Multiplicity.ONE);
                  if (_equals_5) {
                    _builder.append("\t");
                    _builder.append("@OneToOne");
                    _builder.append("\t\t\t\t\t");
                  } else {
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t");
                    _builder.append("@ManyToOne");
                    _builder.newLine();
                  }
                }
                _builder.append("\t");
                _builder.append("private ");
                Association _association_10 = associationEnd.getAssociation();
                EList<AssociationEnd> _associationEnd_11 = _association_10.getAssociationEnd();
                AssociationEnd _get_10 = _associationEnd_11.get(1);
                Entity _associatedEntity_4 = _get_10.getAssociatedEntity();
                String _name_23 = _associatedEntity_4.getName();
                _builder.append(_name_23, "	");
                _builder.append(" ");
                Association _association_11 = associationEnd.getAssociation();
                EList<AssociationEnd> _associationEnd_12 = _association_11.getAssociationEnd();
                AssociationEnd _get_11 = _associationEnd_12.get(1);
                String _name_24 = _get_11.getName();
                _builder.append(_name_24, "	");
                _builder.append(";");
                _builder.newLineIfNotEmpty();
              } else {
                {
                  Multiplicity _multiplicity_5 = associationEnd.getMultiplicity();
                  boolean _equals_6 = Objects.equal(_multiplicity_5, Multiplicity.ONE);
                  if (_equals_6) {
                    _builder.append("\t");
                    _builder.append("@OneToMany(mappedBy=\"");
                    String _name_25 = associationEnd.getName();
                    _builder.append(_name_25, "	");
                    _builder.append("\")");
                    _builder.newLineIfNotEmpty();
                  } else {
                    _builder.append("\t");
                    _builder.append("@ManyToMany");
                    _builder.append("\t\t\t\t\t");
                  }
                }
                _builder.newLineIfNotEmpty();
                _builder.append("\t");
                _builder.append("private List<");
                Association _association_12 = associationEnd.getAssociation();
                EList<AssociationEnd> _associationEnd_13 = _association_12.getAssociationEnd();
                AssociationEnd _get_12 = _associationEnd_13.get(1);
                Entity _associatedEntity_5 = _get_12.getAssociatedEntity();
                String _name_26 = _associatedEntity_5.getName();
                _builder.append(_name_26, "	");
                _builder.append("> ");
                Association _association_13 = associationEnd.getAssociation();
                EList<AssociationEnd> _associationEnd_14 = _association_13.getAssociationEnd();
                AssociationEnd _get_13 = _associationEnd_14.get(1);
                String _name_27 = _get_13.getName();
                _builder.append(_name_27, "	");
                _builder.append(" = new ArrayList<");
                Association _association_14 = associationEnd.getAssociation();
                EList<AssociationEnd> _associationEnd_15 = _association_14.getAssociationEnd();
                AssociationEnd _get_14 = _associationEnd_15.get(1);
                Entity _associatedEntity_6 = _get_14.getAssociatedEntity();
                String _name_28 = _associatedEntity_6.getName();
                _builder.append(_name_28, "	");
                _builder.append(">();");
                _builder.newLineIfNotEmpty();
              }
            }
            _builder.append("\t");
            _builder.newLine();
            _builder.append("\t");
            Association _association_15 = associationEnd.getAssociation();
            EList<AssociationEnd> _associationEnd_16 = _association_15.getAssociationEnd();
            AssociationEnd _get_15 = _associationEnd_16.get(1);
            CharSequence _generateGetter_2 = this.generateGetter(_get_15);
            _builder.append(_generateGetter_2, "	");
            _builder.newLineIfNotEmpty();
            _builder.newLine();
            _builder.append("\t");
            Association _association_16 = associationEnd.getAssociation();
            EList<AssociationEnd> _associationEnd_17 = _association_16.getAssociationEnd();
            AssociationEnd _get_16 = _associationEnd_17.get(1);
            CharSequence _generateSetter_2 = this.generateSetter(_get_16);
            _builder.append(_generateSetter_2, "	");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.newLine();
          }
        }
      }
    }
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  protected CharSequence _generateGetter(final Attribute attribute) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("public ");
    FeatureType _type = attribute.getType();
    DataType _dataType = _type.getDataType();
    String _name = _dataType.getName();
    _builder.append(_name, "");
    _builder.append(" get");
    String _name_1 = attribute.getName();
    String _firstUpper = StringExtensions.toFirstUpper(_name_1);
    _builder.append(_firstUpper, "");
    _builder.append("() {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("return this.");
    String _name_2 = attribute.getName();
    _builder.append(_name_2, "	");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  protected CharSequence _generateSetter(final Attribute attribute) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("public void set");
    String _name = attribute.getName();
    String _firstUpper = StringExtensions.toFirstUpper(_name);
    _builder.append(_firstUpper, "");
    _builder.append("(");
    FeatureType _type = attribute.getType();
    DataType _dataType = _type.getDataType();
    String _name_1 = _dataType.getName();
    _builder.append(_name_1, "");
    _builder.append(" ");
    String _name_2 = attribute.getName();
    _builder.append(_name_2, "");
    _builder.append(") {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("this.");
    String _name_3 = attribute.getName();
    _builder.append(_name_3, "	");
    _builder.append(" = ");
    String _name_4 = attribute.getName();
    _builder.append(_name_4, "	");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  protected CharSequence _generateGetter(final AssociationEnd associationEnd) {
    StringConcatenation _builder = new StringConcatenation();
    {
      Multiplicity _multiplicity = associationEnd.getMultiplicity();
      boolean _equals = Objects.equal(_multiplicity, Multiplicity.ONE);
      if (_equals) {
        _builder.append("public ");
        Entity _associatedEntity = associationEnd.getAssociatedEntity();
        String _name = _associatedEntity.getName();
        _builder.append(_name, "");
        _builder.append(" get");
        String _name_1 = associationEnd.getName();
        String _firstUpper = StringExtensions.toFirstUpper(_name_1);
        _builder.append(_firstUpper, "");
        _builder.append("() {");
        _builder.newLineIfNotEmpty();
      } else {
        _builder.append("public List<");
        Entity _associatedEntity_1 = associationEnd.getAssociatedEntity();
        String _name_2 = _associatedEntity_1.getName();
        _builder.append(_name_2, "");
        _builder.append("> get");
        String _name_3 = associationEnd.getName();
        String _firstUpper_1 = StringExtensions.toFirstUpper(_name_3);
        _builder.append(_firstUpper_1, "");
        _builder.append("() {");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("return ");
    String _name_4 = associationEnd.getName();
    _builder.append(_name_4, "");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  protected CharSequence _generateSetter(final AssociationEnd associationEnd) {
    StringConcatenation _builder = new StringConcatenation();
    {
      Multiplicity _multiplicity = associationEnd.getMultiplicity();
      boolean _equals = Objects.equal(_multiplicity, Multiplicity.ONE);
      if (_equals) {
        _builder.append("public void set");
        String _name = associationEnd.getName();
        String _firstUpper = StringExtensions.toFirstUpper(_name);
        _builder.append(_firstUpper, "");
        _builder.append("(");
        Entity _associatedEntity = associationEnd.getAssociatedEntity();
        String _name_1 = _associatedEntity.getName();
        _builder.append(_name_1, "");
        _builder.append(" ");
        String _name_2 = associationEnd.getName();
        _builder.append(_name_2, "");
        _builder.append(") {");
        _builder.newLineIfNotEmpty();
      } else {
        _builder.append("public void set");
        String _name_3 = associationEnd.getName();
        String _firstUpper_1 = StringExtensions.toFirstUpper(_name_3);
        _builder.append(_firstUpper_1, "");
        _builder.append("(List<");
        Entity _associatedEntity_1 = associationEnd.getAssociatedEntity();
        String _name_4 = _associatedEntity_1.getName();
        _builder.append(_name_4, "");
        _builder.append("> ");
        String _name_5 = associationEnd.getName();
        _builder.append(_name_5, "");
        _builder.append(") {");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("this.");
    String _name_6 = associationEnd.getName();
    _builder.append(_name_6, "");
    _builder.append(" = ");
    String _name_7 = associationEnd.getName();
    _builder.append(_name_7, "");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateInterface(final OSGiBusinessComponent component) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".business.interfaces;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("import java.lang.String;");
    _builder.newLine();
    _builder.append("import java.lang.Integer;");
    _builder.newLine();
    _builder.append("import java.util.Date;");
    _builder.newLine();
    _builder.append("import java.util.List;");
    _builder.newLine();
    _builder.append("import java.util.ArrayList;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".entities.*;");
    _builder.newLineIfNotEmpty();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc.enumerations.*;");
    _builder.newLineIfNotEmpty();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc.exceptions.*;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("public interface I");
    String _name = component.getName();
    _builder.append(_name, "");
    _builder.append("\t");
    _builder.newLineIfNotEmpty();
    _builder.append("{");
    _builder.newLine();
    {
      EList<OSGiBusinessService> _businessService = component.getBusinessService();
      for(final OSGiBusinessService service : _businessService) {
        _builder.append("\t");
        CharSequence _generate = this.generate(service);
        _builder.append(_generate, "	");
        _builder.append(";");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateImplementation(final OSGiBusinessComponent component) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("\t");
    _builder.append("package ");
    _builder.append(this.projectPrefix, "	");
    _builder.append(".business.implementation;");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("import java.lang.String;");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("import java.lang.Integer;");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("import java.util.Date;");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("import java.util.List;");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("import java.util.ArrayList;");
    _builder.newLine();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("import ");
    _builder.append(this.projectPrefix, "	");
    _builder.append(".entities.*;");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("import ");
    _builder.append(this.projectPrefix, "	");
    _builder.append(".misc.enumerations.*;");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("import ");
    _builder.append(this.projectPrefix, "	");
    _builder.append(".misc.exceptions.*;");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("import ");
    _builder.append(this.projectPrefix, "	");
    _builder.append(".business.interfaces.I");
    String _name = component.getName();
    _builder.append(_name, "	");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    {
      EList<Component> _dependencies = component.getDependencies();
      for(final Component dependency : _dependencies) {
        _builder.append("\t");
        _builder.append("import ");
        _builder.append(this.projectPrefix, "	");
        _builder.append(".business.interfaces.I");
        String _name_1 = dependency.getName();
        _builder.append(_name_1, "	");
        _builder.append(";");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public class ");
    String _name_2 = component.getName();
    _builder.append(_name_2, "	");
    _builder.append(" ");
    {
      Component _superComp = component.getSuperComp();
      boolean _notEquals = (!Objects.equal(_superComp, null));
      if (_notEquals) {
        _builder.append("extends ");
        Component _superComp_1 = component.getSuperComp();
        String _name_3 = _superComp_1.getName();
        _builder.append(_name_3, "	");
        _builder.append(" ");
      }
    }
    _builder.append("implements I");
    String _name_4 = component.getName();
    _builder.append(_name_4, "	");
    _builder.append(" {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.newLine();
    {
      EList<Component> _dependencies_1 = component.getDependencies();
      for(final Component dependency_1 : _dependencies_1) {
        _builder.append("\t\t");
        _builder.append("private I");
        String _name_5 = dependency_1.getName();
        _builder.append(_name_5, "		");
        _builder.append(" ");
        String _name_6 = dependency_1.getName();
        String _firstLower = StringExtensions.toFirstLower(_name_6);
        _builder.append(_firstLower, "		");
        _builder.append(" = new ");
        String _name_7 = dependency_1.getName();
        _builder.append(_name_7, "		");
        _builder.append("();");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("\t\t");
    _builder.newLine();
    {
      EList<OSGiBusinessService> _businessService = component.getBusinessService();
      for(final OSGiBusinessService service : _businessService) {
        _builder.append("\t\t");
        _builder.append("@Override");
        _builder.newLine();
        _builder.append("\t\t");
        CharSequence _generate = this.generate(service);
        _builder.append(_generate, "		");
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t");
        _builder.append("{");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("\t");
        _builder.append("// TODO Auto-generated method stub");
        _builder.newLine();
        {
          ReturnType _returns = service.getReturns();
          boolean _equals = Objects.equal(_returns, null);
          if (_equals) {
          } else {
            {
              boolean _or = false;
              ReturnType _returns_1 = service.getReturns();
              FeatureType _type = _returns_1.getType();
              DataType _dataType = _type.getDataType();
              String _exampleValue = _dataType.getExampleValue();
              boolean _equals_1 = Objects.equal(_exampleValue, null);
              if (_equals_1) {
                _or = true;
              } else {
                ReturnType _returns_2 = service.getReturns();
                FeatureType _type_1 = _returns_2.getType();
                Multiplicity _multiplicity = _type_1.getMultiplicity();
                boolean _notEquals_1 = (!Objects.equal(_multiplicity, Multiplicity.ONE));
                _or = (_equals_1 || _notEquals_1);
              }
              if (_or) {
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("return null;");
                _builder.newLine();
              } else {
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("return ");
                ReturnType _returns_3 = service.getReturns();
                FeatureType _type_2 = _returns_3.getType();
                DataType _dataType_1 = _type_2.getDataType();
                String _exampleValue_1 = _dataType_1.getExampleValue();
                _builder.append(_exampleValue_1, "			");
                _builder.append(";");
                _builder.newLineIfNotEmpty();
              }
            }
          }
        }
        _builder.append("\t\t");
        _builder.append("}");
        _builder.newLine();
      }
    }
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generate(final OSGiBusinessService service) {
    StringConcatenation _builder = new StringConcatenation();
    {
      ReturnType _returns = service.getReturns();
      boolean _equals = Objects.equal(_returns, null);
      if (_equals) {
        _builder.append("public void ");
        String _name = service.getName();
        _builder.append(_name, "");
        _builder.append("(");
        _builder.newLineIfNotEmpty();
      } else {
        {
          ReturnType _returns_1 = service.getReturns();
          FeatureType _type = _returns_1.getType();
          Multiplicity _multiplicity = _type.getMultiplicity();
          boolean _equals_1 = Objects.equal(_multiplicity, Multiplicity.ONE);
          if (_equals_1) {
            _builder.append("public ");
            ReturnType _returns_2 = service.getReturns();
            FeatureType _type_1 = _returns_2.getType();
            DataType _dataType = _type_1.getDataType();
            String _name_1 = _dataType.getName();
            _builder.append(_name_1, "");
            _builder.append(" ");
            String _name_2 = service.getName();
            _builder.append(_name_2, "");
            _builder.append("(");
            _builder.newLineIfNotEmpty();
          } else {
            _builder.append("public List<");
            ReturnType _returns_3 = service.getReturns();
            FeatureType _type_2 = _returns_3.getType();
            DataType _dataType_1 = _type_2.getDataType();
            String _name_3 = _dataType_1.getName();
            _builder.append(_name_3, "");
            _builder.append("> ");
            String _name_4 = service.getName();
            _builder.append(_name_4, "");
            _builder.append("(");
            _builder.newLineIfNotEmpty();
          }
        }
      }
    }
    {
      EList<BusinessServiceParameter> _parameters = service.getParameters();
      for(final BusinessServiceParameter parameter : _parameters) {
        {
          FeatureType _type_3 = parameter.getType();
          Multiplicity _multiplicity_1 = _type_3.getMultiplicity();
          boolean _equals_2 = Objects.equal(_multiplicity_1, Multiplicity.ONE);
          if (_equals_2) {
            FeatureType _type_4 = parameter.getType();
            DataType _dataType_2 = _type_4.getDataType();
            String _name_5 = _dataType_2.getName();
            _builder.append(_name_5, "");
            _builder.append(" ");
            String _name_6 = parameter.getName();
            _builder.append(_name_6, "");
            _builder.newLineIfNotEmpty();
          } else {
            _builder.append("List<");
            FeatureType _type_5 = parameter.getType();
            DataType _dataType_3 = _type_5.getDataType();
            String _name_7 = _dataType_3.getName();
            _builder.append(_name_7, "");
            _builder.append("> ");
            String _name_8 = parameter.getName();
            _builder.append(_name_8, "");
            _builder.newLineIfNotEmpty();
          }
        }
        {
          EList<BusinessServiceParameter> _parameters_1 = service.getParameters();
          BusinessServiceParameter _last = IterableExtensions.<BusinessServiceParameter>last(_parameters_1);
          boolean _notEquals = (!Objects.equal(parameter, _last));
          if (_notEquals) {
            _builder.append(",");
          }
        }
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append(")");
    _builder.newLine();
    {
      EList<sysmodel.Exception> _thrownExceptions = service.getThrownExceptions();
      boolean _isEmpty = _thrownExceptions.isEmpty();
      boolean _not = (!_isEmpty);
      if (_not) {
        _builder.append("throws");
        _builder.newLine();
        {
          EList<sysmodel.Exception> _thrownExceptions_1 = service.getThrownExceptions();
          for(final sysmodel.Exception exception : _thrownExceptions_1) {
            String _name_9 = exception.getName();
            _builder.append(_name_9, "");
            {
              EList<sysmodel.Exception> _thrownExceptions_2 = service.getThrownExceptions();
              sysmodel.Exception _last_1 = IterableExtensions.<sysmodel.Exception>last(_thrownExceptions_2);
              boolean _notEquals_1 = (!Objects.equal(exception, _last_1));
              if (_notEquals_1) {
                _builder.append(",");
              }
            }
            _builder.newLineIfNotEmpty();
          }
        }
      }
    }
    return _builder;
  }
  
  public CharSequence generateInterface(final OSGiRestComponent component) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".");
    String _name = component.getName();
    String _lowerCase = _name.toLowerCase();
    _builder.append(_lowerCase, "");
    _builder.append(".interfaces;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("import java.lang.String;");
    _builder.newLine();
    _builder.append("import java.util.Date;");
    _builder.newLine();
    _builder.append("import java.util.List;");
    _builder.newLine();
    _builder.append("import java.util.ArrayList;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import javax.ws.rs.core.*;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".entities.*;");
    _builder.newLineIfNotEmpty();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc.enumerations.*;");
    _builder.newLineIfNotEmpty();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc.exceptions.*;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("public interface I");
    String _name_1 = component.getName();
    _builder.append(_name_1, "");
    _builder.append(" {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    {
      EList<OSGiRestService> _restService = component.getRestService();
      for(final OSGiRestService service : _restService) {
        CharSequence _generateDefinition = this.generateDefinition(service);
        _builder.append(_generateDefinition, "");
        _builder.append(";");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("};");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateImplementation(final OSGiRestComponent component) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".");
    String _name = component.getName();
    String _lowerCase = _name.toLowerCase();
    _builder.append(_lowerCase, "");
    _builder.append(".implementation;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("import java.lang.String;");
    _builder.newLine();
    _builder.append("import java.util.Date;");
    _builder.newLine();
    _builder.append("import java.util.List;");
    _builder.newLine();
    _builder.append("import java.util.ArrayList;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import javax.ws.rs.*;");
    _builder.newLine();
    _builder.append("import javax.ws.rs.core.*;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".entities.*;");
    _builder.newLineIfNotEmpty();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc.enumerations.*;");
    _builder.newLineIfNotEmpty();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".misc.exceptions.*;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("import ");
    _builder.append(this.projectPrefix, "");
    _builder.append(".");
    String _name_1 = component.getName();
    String _lowerCase_1 = _name_1.toLowerCase();
    _builder.append(_lowerCase_1, "");
    _builder.append(".interfaces.I");
    String _name_2 = component.getName();
    _builder.append(_name_2, "");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    {
      EList<Component> _dependencies = component.getDependencies();
      for(final Component dependency : _dependencies) {
        {
          if ((dependency instanceof OSGiBusinessComponent)) {
            _builder.append("import ");
            _builder.append(this.projectPrefix, "");
            _builder.append(".business.interfaces.I");
            String _name_3 = dependency.getName();
            _builder.append(_name_3, "");
            _builder.append(";");
            _builder.newLineIfNotEmpty();
          }
        }
      }
    }
    _builder.newLine();
    {
      EList<Component> _dependencies_1 = component.getDependencies();
      for(final Component dependency_1 : _dependencies_1) {
        {
          if ((dependency_1 instanceof OSGiBusinessComponent)) {
            _builder.append("import ");
            _builder.append(this.projectPrefix, "");
            _builder.append(".business.implementation.");
            String _name_4 = dependency_1.getName();
            _builder.append(_name_4, "");
            _builder.append(";");
            _builder.newLineIfNotEmpty();
          }
        }
      }
    }
    _builder.newLine();
    _builder.append("@Path(\"/");
    String _name_5 = component.getName();
    String _lowerCase_2 = _name_5.toLowerCase();
    _builder.append(_lowerCase_2, "");
    _builder.append("\")");
    _builder.newLineIfNotEmpty();
    _builder.append("public class ");
    String _name_6 = component.getName();
    _builder.append(_name_6, "");
    _builder.append(" ");
    {
      Component _superComp = component.getSuperComp();
      boolean _notEquals = (!Objects.equal(_superComp, null));
      if (_notEquals) {
        _builder.append("extends ");
        Component _superComp_1 = component.getSuperComp();
        String _name_7 = _superComp_1.getName();
        _builder.append(_name_7, "");
        _builder.append(" ");
      }
    }
    _builder.append("implements I");
    String _name_8 = component.getName();
    _builder.append(_name_8, "");
    _builder.append(" {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    {
      EList<Component> _dependencies_2 = component.getDependencies();
      for(final Component dependency_2 : _dependencies_2) {
        _builder.append("\t");
        _builder.append("private I");
        String _name_9 = dependency_2.getName();
        _builder.append(_name_9, "	");
        _builder.append(" ");
        String _name_10 = dependency_2.getName();
        String _firstLower = StringExtensions.toFirstLower(_name_10);
        _builder.append(_firstLower, "	");
        _builder.append(" = new ");
        String _name_11 = dependency_2.getName();
        _builder.append(_name_11, "	");
        _builder.append("();");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("\t");
    _builder.newLine();
    {
      EList<OSGiRestService> _restService = component.getRestService();
      for(final OSGiRestService service : _restService) {
        _builder.append("\t");
        CharSequence _generateRSService = this.generateRSService(service);
        _builder.append(_generateRSService, "	");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateRSService(final OSGiRestService service) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@");
    HttpMethod _method = service.getMethod();
    String _name = _method.name();
    _builder.append(_name, "");
    _builder.newLineIfNotEmpty();
    _builder.append("@Path(\"");
    String _path = service.getPath();
    _builder.append(_path, "");
    {
      EList<RestServiceParameter> _restParameters = service.getRestParameters();
      for(final RestServiceParameter pathparam : _restParameters) {
        _builder.append("/{");
        String _pathParam = pathparam.getPathParam();
        _builder.append(_pathParam, "");
        _builder.append("}");
      }
    }
    _builder.append("\")");
    _builder.newLineIfNotEmpty();
    {
      ReturnType _returns = service.getReturns();
      boolean _notEquals = (!Objects.equal(_returns, null));
      if (_notEquals) {
        _builder.append("@Produces(\"");
        {
          ReturnType _returns_1 = service.getReturns();
          FeatureType _type = _returns_1.getType();
          DataType _dataType = _type.getDataType();
          String _name_1 = _dataType.getName();
          boolean _equals = _name_1.equals("String");
          if (_equals) {
            _builder.append("text/plain");
          }
        }
        _builder.append("\")");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("@Override");
    _builder.newLine();
    {
      ReturnType _returns_2 = service.getReturns();
      boolean _equals_1 = Objects.equal(_returns_2, null);
      if (_equals_1) {
        _builder.append("public void ");
        String _name_2 = service.getName();
        String _firstLower = StringExtensions.toFirstLower(_name_2);
        _builder.append(_firstLower, "");
        _builder.append("(");
        _builder.newLineIfNotEmpty();
      } else {
        _builder.append("public Response ");
        String _name_3 = service.getName();
        String _firstLower_1 = StringExtensions.toFirstLower(_name_3);
        _builder.append(_firstLower_1, "");
        _builder.append("(");
        _builder.newLineIfNotEmpty();
      }
    }
    {
      EList<RestServiceParameter> _restParameters_1 = service.getRestParameters();
      for(final RestServiceParameter param : _restParameters_1) {
        _builder.append("@PathParam(\"");
        String _pathParam_1 = param.getPathParam();
        _builder.append(_pathParam_1, "");
        _builder.append("\") ");
        FeatureType _type_1 = param.getType();
        DataType _dataType_1 = _type_1.getDataType();
        String _name_4 = _dataType_1.getName();
        _builder.append(_name_4, "");
        _builder.append(" ");
        String _name_5 = param.getName();
        _builder.append(_name_5, "");
        {
          EList<RestServiceParameter> _restParameters_2 = service.getRestParameters();
          RestServiceParameter _last = IterableExtensions.<RestServiceParameter>last(_restParameters_2);
          boolean _notEquals_1 = (!Objects.equal(param, _last));
          if (_notEquals_1) {
            _builder.append(", ");
          }
        }
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t");
      }
    }
    _builder.append(") {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("System.out.println(\"INFO: ");
    String _name_6 = service.getName();
    _builder.append(_name_6, "	");
    _builder.append(" service called....\");");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("return Response.status(200).entity(\"");
    String _name_7 = service.getName();
    _builder.append(_name_7, "	");
    _builder.append(" called successfully!\").build();");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    return _builder;
  }
  
  public CharSequence generateDefinition(final OSGiRestService service) {
    StringConcatenation _builder = new StringConcatenation();
    {
      ReturnType _returns = service.getReturns();
      boolean _equals = Objects.equal(_returns, null);
      if (_equals) {
        _builder.append("public void ");
        String _name = service.getName();
        String _firstLower = StringExtensions.toFirstLower(_name);
        _builder.append(_firstLower, "");
        _builder.append("( ");
        _builder.newLineIfNotEmpty();
      } else {
        _builder.append("public Response ");
        String _name_1 = service.getName();
        String _firstLower_1 = StringExtensions.toFirstLower(_name_1);
        _builder.append(_firstLower_1, "");
        _builder.append("(");
        _builder.newLineIfNotEmpty();
      }
    }
    {
      EList<RestServiceParameter> _restParameters = service.getRestParameters();
      for(final RestServiceParameter parameter : _restParameters) {
        {
          FeatureType _type = parameter.getType();
          Multiplicity _multiplicity = _type.getMultiplicity();
          boolean _equals_1 = Objects.equal(_multiplicity, Multiplicity.ONE);
          if (_equals_1) {
            FeatureType _type_1 = parameter.getType();
            DataType _dataType = _type_1.getDataType();
            String _name_2 = _dataType.getName();
            _builder.append(_name_2, "");
            _builder.append(" ");
            String _name_3 = parameter.getName();
            _builder.append(_name_3, "");
            _builder.newLineIfNotEmpty();
          } else {
            _builder.append("List<");
            FeatureType _type_2 = parameter.getType();
            DataType _dataType_1 = _type_2.getDataType();
            String _name_4 = _dataType_1.getName();
            _builder.append(_name_4, "");
            _builder.append("> ");
            String _name_5 = parameter.getName();
            _builder.append(_name_5, "");
            _builder.newLineIfNotEmpty();
          }
        }
        {
          EList<RestServiceParameter> _restParameters_1 = service.getRestParameters();
          RestServiceParameter _last = IterableExtensions.<RestServiceParameter>last(_restParameters_1);
          boolean _notEquals = (!Objects.equal(parameter, _last));
          if (_notEquals) {
            _builder.append(",");
          }
        }
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t");
      }
    }
    _builder.append(")");
    _builder.newLineIfNotEmpty();
    return _builder;
  }
  
  public void compile(final EObject component, final IFileSystemAccess fsa) {
    if (component instanceof OSGiBusinessComponent) {
      _compile((OSGiBusinessComponent)component, fsa);
      return;
    } else if (component instanceof OSGiRestComponent) {
      _compile((OSGiRestComponent)component, fsa);
      return;
    } else if (component instanceof Entity) {
      _compile((Entity)component, fsa);
      return;
    } else if (component instanceof Enumeration) {
      _compile((Enumeration)component, fsa);
      return;
    } else if (component instanceof sysmodel.Exception) {
      _compile((sysmodel.Exception)component, fsa);
      return;
    } else if (component instanceof SystemModel) {
      _compile((SystemModel)component, fsa);
      return;
    } else if (component != null) {
      _compile(component, fsa);
      return;
    } else {
      throw new IllegalArgumentException("Unhandled parameter types: " +
        Arrays.<Object>asList(component, fsa).toString());
    }
  }
  
  public CharSequence generateGetter(final NamedElement associationEnd) {
    if (associationEnd instanceof AssociationEnd) {
      return _generateGetter((AssociationEnd)associationEnd);
    } else if (associationEnd instanceof Attribute) {
      return _generateGetter((Attribute)associationEnd);
    } else {
      throw new IllegalArgumentException("Unhandled parameter types: " +
        Arrays.<Object>asList(associationEnd).toString());
    }
  }
  
  public CharSequence generateSetter(final NamedElement associationEnd) {
    if (associationEnd instanceof AssociationEnd) {
      return _generateSetter((AssociationEnd)associationEnd);
    } else if (associationEnd instanceof Attribute) {
      return _generateSetter((Attribute)associationEnd);
    } else {
      throw new IllegalArgumentException("Unhandled parameter types: " +
        Arrays.<Object>asList(associationEnd).toString());
    }
  }
}
